//
//  SetViewController.m
//  FileSharing
//
//  Created by 祁俊喜 on 2024/4/23.
//

#import "SetViewController.h"
#import "ReadWebController.h"
#import <JXKitManage/JXKitManage.h>
#import "ZFNormalViewController.h"
#import "FileMacros.h"

@interface SetViewController ()

@end

@implementation SetViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.view.backgroundColor = [UIColor systemGroupedBackgroundColor];
    
    [self createButton:CGRectMake(60, 80, 100, 100) title:@"80小说网" tag:1000];
    
    [self createButton:CGRectMake(150, 150, 100, 100) title:@"百度" tag:1001];

    [self createButton:CGRectMake(250, 50, 100, 100) title:@"清空剪切板" tag:1002];
    
    [self createButton:CGRectMake(50, 200, 100, 100) title:@"视频" tag:1003];
    
    [self createButton:CGRectMake(kScreenWidth - 150, 140, 100, 100) title:@"星空影院" tag:1004];
    
}

-(void)buttonAction:(UIButton *)button {
    if (button.tag == 1000) {
        ReadWebController *vc = [[ReadWebController alloc] init];
        vc.urlStr = @"https://m.txt8080.cc/";
        [self.navigationController pushViewController:vc animated:YES];
    } else if (button.tag == 1001) {
        ReadWebController *vc = [[ReadWebController alloc] init];
        vc.urlStr = @"https://www.baidu.com";
        [self.navigationController pushViewController:vc animated:YES];
    } else if (button.tag == 1002) {
        UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
        pasteboard.string = nil;
        [JXProgressHUD showMessage:@"清空成功！"];
    } else if (button.tag == 1003) {
        ZFNormalViewController *vc = [[ZFNormalViewController alloc] init];
        [self.navigationController pushViewController:vc animated:YES];
    } else if (button.tag == 1004) {
        ReadWebController *vc = [[ReadWebController alloc] init];
        vc.urlStr = @"https://www.xmhlae.com";
        [self.navigationController pushViewController:vc animated:YES];
    }
}

-(void)createButton:(CGRect)frame title:(NSString *)title tag:(NSInteger)tag {
    UIButton *button = [UIButton buttonWithType:UIButtonTypeSystem];
    button.frame = frame;
    [button setTitle:title forState:(UIControlStateNormal)];
    button.tag = tag;
    [button setTitleColor:[UIColor systemBlueColor] forState:(UIControlStateNormal)];
    button.titleLabel.font = [UIFont systemFontOfSize:16];
    [button addTarget:self action:@selector(buttonAction:) forControlEvents:(UIControlEventTouchUpInside)];
    [self.view addSubview:button];
}

@end
